package cn.com.lei.du.service;

import cn.com.lei.du.entity.User;
import cn.com.lei.du.service.impl.UserServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "eureka-client" ,fallbackFactory = UserServiceFallbackFactory.class)//fallback = UserServiceFallback.class)//该处的value为服务的名字
public interface UserService {

    @GetMapping("/user/feign/getUser")
    User getUser();

    @GetMapping("/user/feign/getUserParam")
    User getUserParam(@RequestParam("name") String name);

    @GetMapping("/user/feign/getUserHeader")
    User getUserHeader(@RequestHeader("name") String name);

    /**
     * RequestBody必须使用Post传递参数
     */
    @PostMapping("/user/feign/getUserBody")
    User getUserBody(@RequestBody User user);

    @GetMapping("/user/feign/getUserPath/{name}")
    User getUserPath(@PathVariable("name") String name);

    @GetMapping("/user/feign/getUserRetry")
    User getUserRetry();

    @GetMapping("/user/feign/getUserHys")
    User getUserHys();

}
